function mysql(type)
{
	if(type == 'local')
	{
		document.getElementById('db_host').value = "localhost";
		document.getElementById('db_user').value = "root";
		document.getElementById('db_pass').value = "";
		document.getElementById('db_name').value = "xtreme";
		document.getElementById('db_prefixe').value = "xtreme";
		document.getElementById('supp_db').checked = true;
		document.getElementById('supp_table').checked = true;
	}
	else if(type == 'perso')
	{
		document.getElementById('db_host').value = "";
		document.getElementById('db_user').value = "";
		document.getElementById('db_pass').value = "";
		document.getElementById('db_name').value = "";
		document.getElementById('db_prefixe').value = "";
		document.getElementById('supp_db').checked = false;
		document.getElementById('supp_table').checked = false;
	}
}

function config_save()
{
	var db_host = $('#db_host').val();
	var db_user = $('#db_user').val();
	var db_pass = $('#db_pass').val();
	var db_name = $('#db_name').val();
	var db_prefixe = $('#db_prefixe').val();
	if (document.getElementById('db_supp').checked == true)
	{
		var db_supp = "checked";
	}
	else
	{
		var db_supp = "";
	}
	
	if (document.getElementById('db_supp_table').checked == true)
	{
		var db_supp_table = "checked";
	}
	else
	{
		var db_supp_table = "";
	}

	var site_titre = $('#site_titre').val();
	var site_slogan = $('#site_slogan').val();
	if (document.getElementById('site_exemple').checked == true)
	{
		var site_exemple = "checked";
	}
	else
	{
		var site_exemple = "";
	}
	var a_pseudo = $('#a_pseudo').val();
	var a_pass = $('#a_pass').val();
	var a_email = $('#a_email').val();
	var a_email_secrete = $('#a_email_secrete').val();
	
	$('#config_create').load('index.php?action=config_create', {
		
		'site_exemple': site_exemple,'db_host': db_host,
		'db_user': db_user,
		'db_pass': db_pass,
		'db_name': db_name,
		'db_prefixe': db_prefixe,
		'db_supp': db_supp,
		'db_supp_table': db_supp_table,
		'site_titre': site_titre,
		'site_slogan': site_slogan,
		'a_pseudo': a_pseudo,
		'a_pass': a_pass,
		'a_email': a_email,
		'a_email_secrete': a_email_secrete
	});
	alert(test);
}

function check_form()
{
	var erreur = "0";
	if(document.getElementById('db_host').value == "")
	{
		var erreur = "1";
		document.getElementById('edb_host').innerHTML = "<img src='action_delete.png'>";
	} else {document.getElementById('edb_host').innerHTML = "";}
	if(document.getElementById('db_user').value == "")
	{
		var erreur = "1";
		document.getElementById('edb_user').innerHTML = "<img src='action_delete.png'>";
	} else {document.getElementById('edb_user').innerHTML = "";}
	if(document.getElementById('db_name').value == "")
	{
		var erreur = "1";
		document.getElementById('edb_name').innerHTML = "<img src='action_delete.png'>";
	} else {document.getElementById('edb_name').innerHTML = "";}
	if(document.getElementById('db_prefixe').value == "")
	{
		var erreur = "1";
		document.getElementById('edb_prefixe').innerHTML = "<img src='action_delete.png'>";
	} else {document.getElementById('edb_prefixe').innerHTML = "";}
	if(document.getElementById('site_titre').value == "")
	{
		var erreur = "1";
		document.getElementById('esite_titre').innerHTML = "<img src='action_delete.png'>";
	} else {document.getElementById('esite_titre').innerHTML = "";}
	if(document.getElementById('site_slogan').value == "")
	{
		var erreur = "1";
		document.getElementById('esite_slogan').innerHTML = "<img src='action_delete.png'>";
	} else {document.getElementById('esite_slogan').innerHTML = "";}
	
	var pseudo = document.getElementById('a_pseudo').value;
	var myFilter=/^(([a-z])([a-z0-9-_]*))$/gi;
	
	if((pseudo != "")&&(pseudo != "defaut")&&(pseudo != "visiteur"))
	{
		if((pseudo.length >= 4)&&(pseudo.length <= 20))
		{
			if(pseudo.match(myFilter))
			{
				document.getElementById('ea_pseudo').innerHTML = "";
			}
			else
			{
				var erreur = "1";
				document.getElementById('ea_pseudo').innerHTML = "<img src='action_delete.png'>";
			}
		}
		else
		{
			var erreur = "1";
			document.getElementById('ea_pseudo').innerHTML = "<img src='action_delete.png'>";
		}
	}
	else
	{
		var erreur = "1";
		document.getElementById('ea_pseudo').innerHTML = "<img src='action_delete.png'>";
	}
	
	var pass = document.getElementById('a_pass').value;
	var pass_filtre = /^[0-9][a-zA-Z]$/i;
	if(pass != "")
	{
		if((pass.length >= 4)&&(pass.length <= 20))
		{
			if((pass.match(/[0-9]/i))&&(pass.match(/[a-z]/i)))
			{
				document.getElementById('ea_pass').innerHTML = "";
			}
			else
			{
				var erreur = "1";
				document.getElementById('ea_pass').innerHTML = "<img src='action_delete.png'>";
			}
		}
		else
		{
			var erreur = "1";
			document.getElementById('ea_pass').innerHTML = "<img src='action_delete.png'>";
		}
	}
	else
	{
		var erreur = "1";
		document.getElementById('ea_pass').innerHTML = "<img src='action_delete.png'>";
	}
	
	if(document.getElementById('a_email').value == "")
	{
		var erreur = "1";
		document.getElementById('ea_email').innerHTML = "<img src='action_delete.png'>";
	} else {document.getElementById('ea_email').innerHTML = "";}
	if(document.getElementById('a_email_secrete').value == "")
	{
		var erreur = "1";
		document.getElementById('ea_email_secrete').innerHTML = "<img src='action_delete.png'>";
	} else {document.getElementById('ea_email_secrete').innerHTML = "";}
	
	if(erreur == "0")
	{
		return true; 
	}
	else
	{
		return false;
	}
}

function menu(data)
{
	if(confirm('test'))
	{
		history.go(data);
	}
}

function install()
{
	if(confirm('test'))
	{
		return true;
	}
	else
	{
		return false;
	}
}